package com.yhgarden.bbs.controller.business;

import com.yhgarden.bbs.entity.business.WechatUser;
import com.yhgarden.bbs.model.response.BaseResponse;
import com.yhgarden.bbs.service.api.business.WechatUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
* @author Laijiaxiang
* @since 2019-09-23
*/
@Controller("adminWechatUserController")
@RequestMapping(value = {"/admin/wechatUser","*/admin/wechatUser"})
public class WechatUserController {

    @Autowired
    private WechatUserService wechatUserService;

    @RequestMapping(value = "/createOrUpdate", method = RequestMethod.POST,
                    consumes = {"application/json"},
                    produces = {"application/json"})
    @ResponseBody
    public BaseResponse createOrUpdate(@RequestBody WechatUser wechatUser) {
        BaseResponse res = wechatUserService.createOrUpdate(wechatUser);
        return res;
    }

    @RequestMapping(value = "/getById/{id}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getById(@PathVariable("id") String id) {
        BaseResponse res = wechatUserService.getById(id);
        return res;
    }

    @RequestMapping(value = "/getByIdForList/{id}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getByIdForList(@PathVariable("id") String id) {
        BaseResponse res = wechatUserService.getByIdForList(id);
        return res;
    }

    @RequestMapping(value = "/getByIdMoreDetail/{id}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getByIdMoreDetail(@PathVariable("id") String id) {
        BaseResponse res = wechatUserService.getByIdMoreDetail(id);
        return res;
    }

    @RequestMapping(value = "/queryForList", method = RequestMethod.POST,
                    consumes = {"application/json"},
                    produces = {"application/json"})
    @ResponseBody
    public BaseResponse queryForList(@RequestBody WechatUser wechatUser) {
        BaseResponse res = wechatUserService.queryForList(wechatUser);
        return res;
    }

    @RequestMapping(value = "/queryMoreDetail", method = RequestMethod.POST,
                    consumes = {"application/json"},
                    produces = {"application/json"})
    @ResponseBody
    public BaseResponse queryMoreDetail(@RequestBody WechatUser wechatUser) {
        BaseResponse res = wechatUserService.queryMoreDetail(wechatUser);
        return res;
    }

    @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
    @ResponseBody
    public BaseResponse delete(@PathVariable("id") String id) {
        BaseResponse res = wechatUserService.delete(id);
        return res;
    }

    @RequestMapping(value = "/batchDelete", method = RequestMethod.POST,
            consumes = {"application/json"},
            produces = {"application/json"})
    @ResponseBody
    public BaseResponse batchDelete(@RequestBody List<String> ids) {
        BaseResponse res = wechatUserService.batchDelete(ids);
        return res;
    }

}

